#include<iostream>
using namespace std;

/* int test(){
	int a = 0;
	int b = 0;
	cin >> a >> b;
	if (b == 0){
		throw invalid_argument("除0错误");//抛出异常
	}
	return a / b;
}
 
int main(){
 
	try{
		cout << test() << endl;//可能会出现异常代码
	}
	catch (const exception& e){
		cout << e.what() << endl;//捕获异常
	}
 
	system("pause");
	return 0;
} */
int test(){
	int a = 0;
	int b = 0;
	cin >> a >> b;
	if (b == 0){
 		throw "除0错误";//抛出异常,异常的描述
	}
	return a / b;
}
 
int main(){
 
	try{
		cout << test() << endl;//会出现异常的代码
	}
	//捕获异常
	catch (const char* a){
		cout << a << endl;
	}
	catch (...){
		cout << "unknow exception" << endl;
	}
 
	system("pause");
	return 0;
}